package com.hua.yuan.live.view.holder_view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.TextView;

import com.hua.yuan.common.BaseHolderView;
import com.hua.yuan.live.R;

import java.util.List;

/**
 * 直播列表的ITEM
 */
public class HolderView_RedPackage implements BaseHolderView<Integer>{


    private TextView tvMoney;

    public HolderView_RedPackage(View pView, int pPosition) {

        tvMoney = pView.findViewById(R.id.tv_money_red_package);
    }

    @SuppressLint({"StringFormatInvalid", "StringFormatMatches"})
    @Override
    public void bindHolder(@NonNull List<Integer> pList, int position, @NonNull Context pContext) {

        if (pList == null || pList.size() == 0 || (position > pList.size())) {
            return;
        }

        Integer money = pList.get(position);
        if(money==null){
            return;
        }
        String regex=pContext.getResources().getString(R.string.money_live_room);
        tvMoney.setText(String.format(regex,money));
    }
}
